{% extends 'layout.html' %}
{% load static %}
{% block content %}
<main>
    <!--? Categories Area Start -->
    <div class="categories-area section-padding30" style="background:#f5f5f5;padding-top: 23px;">
        <div class="container">
            <!-- Section body -->
            <div class="row">
                <!-- Introduce -->
                <div class="col-lg-4 col-md-6 col-sm-6">
                    <div class="single-cat mb-50">
                        <div class="cat-icon">
                        <span class="flaticon-education">
                        </span>
                        </div>
                        <div class="cat-cap">
                            <p><strong style="font-size:20px;">使用说明</strong><br>
                                1.点击右侧栏中的 “下载course模板” 按钮，下载最新专业模板文件<br>
                                2.按照模板文件要求填写内容<br>
                                3.点击 “修改专业信息” 进入内容修改<br>
                                4.选择内容完整的 “course模板文件” 上传<br>
                                5.上传成功后，生成完整的培养方案，点击 “下载” 按钮进行下载</p>
                            <a href="" class="read-more1">Refresh ></a>
                        </div>
                    </div>
                </div>
                <!-- Download -->
                <div class="col-lg-8">
                    <div class="about-details-cap mb-50" style="background:#fff">
                        <div class="blog_item_img">
                            <div class="blog_item_date">
                                <h3></h3>
                            </div>
                        </div>
                        <div class="blog_details" style="box-shadow:0px 10px 20px 0px rgb(14 13 13 / 33%);">
                            <aside class="single_sidebar_widget newsletter_widget">
                                <h3 class="widget_title" style="color: #2d2d2d;font-weight:bold;">Download</h3>
                                <hr>
                                <form action="/upcourse/" method="post">
                                    {% csrf_token %}
                                    <!--显示上传过的版本-->
                                    <h5 class="widget_title" style="color: #2d2d2d;font-weight:bold;">已有版本</h5><br>
                                    <div class="form-group">
                                        <input type="hidden" name="edition" id="edition">
                                        {% for item in info %}
                                            <button type="submit" value="{{item.0}}" class="genric-btn primary circle" id="edition_button{{item.0}}">{{item.1}}年版本</button>
                                        {% endfor %}
<!--                                        {% if isupload %}-->
<!--                                            <input type="button" name="data" value="{{item.1}}年版本" class="genric-btn primary circle">-->
<!--                                        {% endif %}-->
                                    </div>

                                    <hr>
                                    <h5 class="widget_title" style="color: #2d2d2d;font-weight:bold;">基本功能</h5><br>
                                    <a href="/download_word" class="genric-btn primary radio">下载培养方案</a>
                                    <a href="/course_form" target="_blank" class="genric-btn primary radio ">教学进程表</a>
                                    <a href="/download_coursetemplates" class="genric-btn primary radio">下载course模板</a>
                                    <a href="/information" class="genric-btn primary radius">修改专业信息</a>
                                    <a href="/download_Matrix" class="genric-btn primary radius">生成课程-毕业要求矩阵</a>
                                    <a href="/new_matrix" class="genric-btn primary radius">当前课程-毕业要求矩阵</a>
                                    <a href="/download_Supporting_Course" class="genric-btn primary radius" style="margin-top: 20px">生成毕业要求指标分解与支撑课程</a>
                                </form>
                                <form action="/submitcourse/" method="post" enctype="multipart/form-data" name="reg_testdate">
                                    {% csrf_token %}
                                    <br>
                                    选择文件：
                                    <input type="file" name="exc" style="margin:15px">
                                    <br>

                                    选择年份：
                                    <input type="hidden" id="year" name="year">
                                    <select id="sel" style="margin-bottom:15px"></select>

                                    <button class="button rounded-0 primary-bg text-white w-100 btn_1 boxed-btn"
                                            type="submit">上传
                                    </button>
                                    <p> {{ isupload }}</p>

                                </form>
                            </aside>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!-- Categories Area End -->
<script>

    onload = function(){

        // 选择对应年份实时更新
        var year=new Date().getFullYear(); //获取当前年份
        var sel = document.getElementById ('sel');//获取select下拉列表


        for ( var i = year - 10; i < year + 10; i++)//循环添加2006到当前年份加3年的每个年份依次添加到下拉列表
        {
           var option = document.createElement ('option');
           option.value = i;
           if(option.value == 2022)
               option.selected = 'selected';
           var txt = document.createTextNode (i);
           option.appendChild (txt);
           sel.appendChild (option);
        }
        document.getElementById( 'year').value = 2022;
        sel.addEventListener("change", function() {
            document.getElementById('year').value =  this.value;
        });

        //选择版本
        // alert({{ info_length | safe }});
        var edition = document.getElementById("edition");
        for(var i = 1; i <= {{ info_length | safe }} ; i ++ ) {
            document.getElementById("edition_button" + i).addEventListener("click", function() {
                edition.value = this.value;
                console.log(edition.value);
            });
        }

}
</script>
</main>
{% endblock%}